<?php
session_start();
if(isset($_SESSION['userid'])&&$_SESSION['level']!=2)
{
	
	header ("location: login.php");
	exit();
}

?>
<?php
include("includes/top_user.php");
?>
<div id="wrapper">
	<div id="content">
	<h3>Thành Viên</h3>
	<table width="100%">
		<thead>
			<tr>
	            <th width="50px"><a href="#">STT<img src="img/icons/arrow_down_mini.gif" width="16" height="16" align="absmiddle" /></a></th>
	            <th><a href="#">UserName</a></th>
	            <th><a href="#">Họ Tên</a></th>
	            <th><a href="#">Email</a></th>
	            <th width="65px"><a href="#">Level</a></th>
	            <th width="60px"><a href="#">Thực Thi</a></th>
	         </tr>
	     </thead>
	     <tbody>
	         <?php
			 include("includes/connect.php");
			 $sql="select * from user order by id DESC";
			 $query=mysql_query($sql);
			 if(mysql_num_rows($query) == "")
			 {
				 echo "<tr><td colspan=5 align=center>Chưa có username nào</td></tr>";
			}
			else
			{
				$stt=0;
				while($row=mysql_fetch_array($query))
				{
				$stt++;
				echo "<tr>";
				echo "<td>$stt</td>";
				echo "<td size=15>$row[username]</td>";
				echo "<td>$row[hoten]</td>";
				echo "<td>$row[email]</td>";
				if($row['level'] == "1")
				{
					echo "<td>Member</td>";
				}
				else
				{
					echo "<td>Admin</td>";
				}
				echo "<td><a href=show_user.php?userid=$row[id]><img src=img/icons/user.png title=Xem width=16 height=16 /></a><a href=edit_user.php?userid=$row[id]><img src=img/icons/user_edit.png title=Sửa width=16 height=16 /></a><a href=delete_user.php?userid=$row[id]><img src=img/icons/user_delete.png title=Xóa width=16 height=16 /></a></td>";
				}
			}
		
			 ?>
		
		</tbody>
	</table>
	</div><!--content-->
	<?php
	include("includes/sidebar.php");
	?>
</div><!--end wrapper-->

<?php
include("includes/footer.php");
?>
